const Mock = require('mockjs');

/**
 * 法律文件下载
 */
function getFileDownload () {
  let list = []
  let randomNumber = Math.ceil(Math.random() * 6);
  for (let i = 0; i < randomNumber; i++) {
    let item = Mock.mock({
      'FileGuid': Mock.Random.guid(),
      'TypeName': Mock.Random.cword(2) + '类',
      'Files|1-10': [{
        'FileName|+1': [
          Mock.Random.cword(3) + '.pdf',
          Mock.Random.cword(4) + '.doc',
          Mock.Random.cword(5) + '.docx',
          Mock.Random.cword(2) + '.xls',
          Mock.Random.cword(3) + '.xlsx',
          Mock.Random.cword(4) + '.ppt',
          Mock.Random.cword(4) + '.pptx'
        ],
        'FileType|+1': [
          'pdf',
          'doc',
          'docx',
          'xls',
          'xlsx',
          'ppt',
          'pptx'
        ],
        'FilePath': function () {
          return `${Mock.Random.url('https')}/${this["FileName"]}`;
        }
      }]
    })
    list.push(item)
  }
  return list;
}

module.exports = getFileDownload;